<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'plupload.jsp' starting page</title>
<link type="text/css" rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.4/css/jquery-ui.min.css" media="screen" />
<link type="text/css" rel="stylesheet" href="plupload/js/jquery.ui.plupload/css/jquery.ui.plupload.css" media="screen" />
<script type="text/javascript" src="plupload/js/jquery.js"></script>
<script type="text/javascript" src="plupload/js/jquery-ui.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="plupload/js/plupload.full.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="plupload/js/i18n/zh_CN.js"></script>
<script type="text/javascript" src="plupload/js/jquery.ui.plupload/jquery.ui.plupload.min.js" charset="UTF-8"></script>
<script type="text/javascript">
		$(function() {
			$("#uploader").plupload({
				runtimes : 'html5,flash,silverlight,html4',
				url : "plupload/plupload.do",
				max_file_size : '1024mb',// 文件上传最大限制。
				chunk_size : '10mb',// 上传分块每块的大小，这个值小于服务器最大上传限制的值即可
				unique_names: true, // 上传的文件名是否唯一
				// 是否生成缩略图（仅对图片文件有效）
				resize : {
					width : 200,
					height : 200,
					quality : 90,
					crop : true
				},
			   //  这个数组是选择器，就是上传文件时限制的上传文件类型
				filters : [ {
					title : "Image files",
					extensions : "jpg,gif,png"
				}, {
					title : "Zip files",
					extensions : "zip,rar"
				} ],
				// Rename files by clicking on their titles
				rename : true,
				// Sort files
				sortable : true,
				// Enable ability to drag'n'drop files onto the widget (currently only HTML5 supports that)
				dragdrop : true,
				// Views to activate
				views : {
					list : true,
					thumbs : true, // Show thumbs
					active : 'thumbs'
				},
				// Flash settings
				flash_swf_url : 'plupload/js/Moxie.swf',
				// Silverlight settings
				silverlight_xap_url : 'plupload/js/Moxie.xap'
				,
                init : {
                    FileUploaded : function(up, file, info) {//文件上传完毕触发
                        var response = $.parseJSON(info.response);
                        if (response.realPath) {
                        	alert(response.realPath+"   --绝对路径--");
                          //  $('#f1').append('<input type="hidden" name="fileUrl" value="'+response.fileUrl+'"/>');
                           // $('#f1').append('<input type="hidden" name="fileName" value="'+file.name+'"/><br/>');
                        }
                        if(response.raltivePath){
                        	alert(response.raltivePath+"    --相对路径--");
                        }
                    }
                }
			});
		});
	</script>
</head>

<body>
	<div id="uploader" style="width: 600px">
		<p>您的浏览器没有安装Flash插件，或不支持HTML5！</p>
	</div>
	
</body>
</html>
